
<include file="Public/ace_header" />
<div class="row">
    <div class="col-xs-12">
        <div class="row hidden-480 search">
            <form id="search-form">
             <div class="col-md-3 search-input-div">
                    <input type="text" class="col-md-12 search-input" name="name" id="name" value="{$_GET[name]}" placeholder="姓名"/>
                </div>
            <div class="col-md-3 search-input-div">
                    <select name="class_id" id="class_id" class="width-100 search-input">
                        <option value="" class="search-select-default-option">所在班级</option>
                        <php>$foriegnModel = D("class")->select();</php>
                        <volist name="foriegnModel" id="vo">
                        <php>
                           $major=D("major")->where(["id"=>$vo["major_id"]])->find();
                           $grade=D("grade")->where(["id"=>$vo["grade_id"]])->find();
                        </php>
                        <option value="{$vo['id']}" <if condition ="$_GET['class_id'] eq $vo['id']"> selected </if>>{$grade["name"]}{$major["name"]}{$vo['name']}</option>
                        </volist>
                    </select>
                </div>
                <div class="col-md-3 search-input-div">
                    <input type="text" class="col-md-12 search-input" name="identity" id="identity" value="{$_GET[identity]}" placeholder="身份证号"/>
                </div>
                 <div class="col-md-3 search-input-div">
                    <input type="text" class="col-md-12 search-input" name="term_name" id="term_name" value="{$_GET[term_name]}" placeholder="学期及交费项"/>
                </div>
                <div class="col-md-3 col-md-offset-9 center search-input-div">
                    <button type="submit" class="btn btn-success btn-xs">查询</button>
                    <button class="btn btn-warning btn-xs" type="button" href="#" onclick="clearFind()">清空</button>
                  <a class="btn btn-purple btn-xs" href="{:U(import)}">导入</a>
                  <a class="btn btn-pink btn-xs" id="export-btn" href="{:U(export)}" onclick="return exportExcel()">导出</a>
                    <button class="btn btn-danger btn-xs" type="button" href="javascript:void(0);" id="delall">删除</button>
                </div>
            </form>
        </div>
        <div class="table-responsive">
            <table class="table table-striped table-bordered table-hover">
                <thead>
                    <tr>
                        <th class="center">
                            <label>
                                <input type="checkbox" class="ace" id="checkall"/>
                                <span class="lbl"></span>
                            </label>
                        </th>
                    <th class="center">ID</th>
                    <th class="center">学生</th>
                    <th class="center">所在班级</th>
                    <th class="center">身份证号</th>
                    <if condition="$_GET['term_name']">
                    <th class="center">应交总金额</th>
                    <th class="center">实交总金额</th>
                    <php>
                        $fee = D('Fee')->where(['student_id'=>$list[0]['student_id']])->select();
                    </php>
                    <foreach name="fee" item="f">
                    <php>
                     $tuition=D('tuition')->where(['id'=>$f['tuition_id']])->find();
                     $term=D('term')->where(['id'=>$tuition['term_id']])->find();
                    </php>
                    <th class="center">应缴{$term['name']}</th>
                    <th class="center">仍欠{$term['name']}</th>
                    </foreach>
                    <else/>
                    <th class="center">学期及交费项</th>
                    <th class="center">应交学费</th>
                    <th class="center">实交学费</th>
                    </if>
                    <th class="center">缴费经办人</th>
                    <th class="center">退费</th>
                        <th class="center">操作</th>
                    </tr>
                </thead>
                <tbody>
                    <volist name="list" id="vo">
                    <tr>
                        <td class="center">
                            <label>
                                <input type="checkbox" class="ace" name="chkid" value="{$vo['id']}"/>
                                <span class="lbl"></span>
                            </label>
                        </td>
                        <td class="center">{$vo[id]}</td> 
            <php>
            $student=D("Student")->where(["id"=>$vo["student_id"]])->find();
            </php>
            <td class="center">
            {$student["name"]}
            </td>
            <php>
            $student=D("Student")->where(["id"=>$vo["student_id"]])->find();
            $class=D("Class")->where(["id"=>$student["class_id"]])->find();
            $grade=D("Grade")->where(["id"=>$class["grade_id"]])->find();
            $major=D("Major")->where(["id"=>$class["major_id"]])->find();
            </php>
            <td class="center">
            {$grade["name"]}{$major["name"]}{$class["name"]}
            </td>
            
            <php>
            $student=D("Student")->where(["id"=>$vo["student_id"]])->find();
            </php>
            <td class="center">
            {$student["identity"]}
            </td>
             <if condition="$_GET['term_name']">
            <td class="center">{$vo["should"]}</td>
            <td class="center">{$vo[over]}</td>
            <php>
            $fee = D('Fee')->where(['student_id'=>$vo['student_id']])->select();
          </php>
        <foreach name="fee" item="f">
       <th class="center">{$vo[$f['id']]['yingjiao']}</th>
       <th class="center">{$vo[$f['id']]['rengqian']}</th>
        </foreach>
        <else/>
          <php>
            $tuition=D("Tuition")->find($vo["tuition_id"]);
            $term=D("Term")->where(["id"=>$tuition["term_id"]])->find();
            </php>

            <td class="center">
            {$term["name"]}
            </td>
            <php>$tuition= D("Tuition")->find($vo["tuition_id"])</php>
            <php>$shouldModel=D('should')->where(['tuition_id'=>$vo['tuition_id'],'student_id'=>$vo['student_id']])->find();
            </php>
            <if condition="$shouldModel">
            <td class="center">{$shouldModel['should']-$vo[quit]}</td>
            <else/>
             <td class="center">{$tuition['money']-$vo[quit]}</td>
             </if>
            <td class="center">{$vo[over]-$vo[quit]}</td>
            </if>   
        <td class="center">{$vo[name]}</td>
        <td class="center">{$vo[quit]}</td>
                            <td class="center">
                                <div class="visible-md visible-lg hidden-sm hidden-xs btn-group">
                                    <a href="{:U(update, ['id'=>$vo['id']])}">
                                        <button class="btn btn-xs btn-info" style="border: 1px;">
                                            <i class="icon-edit" style="margin-right: 0px;"></i>
                                        </button>
                                    </a>
                                    <a class="delete-btn" id="{$vo['id']}" >
                                        <button class="btn btn-xs btn-danger" style="border: 1px;">
                                            <i class="icon-trash"></i>
                                        </button>
                                    </a>
                                </div>
                                <div class="visible-xs visible-sm hidden-md hidden-lg">
                                    <div class="inline position-relative">
                                        <button class="btn btn-minier btn-primary dropdown-toggle" data-toggle="dropdown">
                                            <i class="icon-cog icon-only bigger-110"></i>
                                        </button>
                                        <ul class="dropdown-menu dropdown-only-icon dropdown-yellow pull-right dropdown-caret dropdown-close">
                                             <li>
                                                <a href="{:U(update, ['id'=>$vo['id']])}" class="tooltip-success" data-rel="tooltip" title="Edit">
                                                    <span class="green">
                                                        <i class="icon-edit bigger-120"></i>
                                                    </span>
                                                </a>
                                            </li>
                                            <li>
                                                <a class="delete-btn" id="{$vo['id']}">
                                                    <span class="red">
                                                        <i class="icon-trash bigger-120"></i>
                                                    </span>
                                                </a>
                                            </li>
                                        </ul>
                                    </div>
                                </div>
                            </td>
                        </tr>
                    </volist>
                </tbody>
            </table>
            {$page}
        </div><!-- /.table-responsive -->
    </div><!-- /span -->
</div><!-- /row -->
<include file="Public/ace_footer" />
